package com.cn.sinsosft.boot.service;

import com.cn.sinsosft.boot.dao.UserDao;
import com.cn.sinsosft.boot.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author wangyupeng
 * @despriction:
 * @ate:Created in 19:29 2019/1/14
 * @modify By:
 */
@Service
@Slf4j
public class UserService {
    @Resource
    private UserDao userDao;

    public String login(User user) {
        String name ="";
        User userinfo = userDao.login(user);
        if (userinfo.getUsername()==null || userinfo.getPassword()==null){
            name ="index";
        }else {
            if (user.getUsername().equals(userinfo.getUsername()) && user.getPassword().equals(userinfo.getPassword())) {
                name = "upload";
            }else {
                name ="index";
            }
        }
        return name;
    }
}
